<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Element对象</title>
</head>
<body>
    <a>点击以下</a>
    <button type="button" id="btn_create">添加链接</button>
    <button type="button" id="btn_delete">删除链接</button>
</body>
</html>
<script>
    var btn_create = document.getElementById("btn_create");
    var element_a = document.getElementsByTagName("a")[0];  //获取第一个a标签
    btn_create.onclick = function(){

        element_a.setAttribute("href","http://www.baidu.com");//为标签添加属性
    }
    document.getElementById("btn_delete").onclick = function(){
        element_a.removeAttribute("href");                    //删除标签的属性

    }
</script>